#include <stdbool.h>

typedef enum { WHITE, BLACK, NOCOLOR } Color;
typedef enum { QUEEN, ROOK, KNIGHT, BISHOP, KING, PAWN, NOPIECE } Piecetype;
typedef enum { NEWMOVE, CASTLING, PROMOTION, ENPASSANT, CHECK, CHECKMATE, NOTYPE } Movetype;
typedef enum { GAMENOTSTARTED, PLAYER1, PLAYER2, GAMEOVER } State;

//sizeof(Square) = 16
typedef struct
{
  Piecetype type;
  Color color;
  unsigned char row;
  unsigned char col;
  bool occupied;
  bool hasMoved;
  bool pawnTwoSquareMove;
} Square;

//sizeof(Packet) = 36
typedef struct
{
  Square src;
  Square dest;
  Movetype type;
}Move;

int recv_packet(int file_desc, char *buf);
int send_packet(int file_desc, char *buf);
void setup_tcp_sockets(char *port_num);
void accept_client_connections();
void *get_in_addr(struct sockaddr *sa);
void get_client_move();
